<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        window.onload=function () {
        var total=document.getElementById("total");
            total.style.backgroundImage="url(./imagconman/荷花.png)";
            total.style.backgroundRepeat="no-repeat";
        var index=0;
        var bgArr=["../imagconman/荷花.png","../imagconman/蝗虫.png","../imagconman/2020318.png","../imagconman/向日葵.png"];
            div01.onclick=function () {
            index--;
            if (index<0){
                index=bgArr.length-1
            }
            total.style.backgroundImage="url("+bgArr[index]+")" ;
        };
            div02.onclick=function () {
                index++;
                if (index>bgArr.length-1){
                    index=0
                }
                total.style.backgroundImage="url("+bgArr[index]+")" ;
            };
        }
    </script>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        #total{
            width: 340px;
            height: 300px;
            /*background: #cccccc;*/
            margin: 0 auto;
        }
        #total:hover{
            cursor: pointer;
        }
        #div01{
            width: 170px;
            height: 300px;
            background-image: url("../imagconman/left.png");
            display: inline-block;

        }
        #div02{
            width: 170px;
            height: 300px;
            background-image: url("../imagconman/right.png");
            float: right;
        }

    </style>
</head>
<body>
<div id="total">
    <div id="div01" >

    </div>
    <div id="div02">

    </div>
</div>
 </body>
</html>